home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Tate Gallery - Exploring Modern Art
/
Tate Gallery - Exploring Modern Art.iso
/
install
/
setup.mst
/
setup.bin
Wrap
Text File
|
1994-07-24
|
19KB
|
643 lines
'**************************************************************************
'* Attica Installation Program
'* D.K. 13/8/92 - modified from SAMPLE1.MST
'* JMS 12/1/94
'**************************************************************************
'' *** $DEFINE DEBUG ''Define for script development/debugging
''$DEFINE DEBUG
'$INCLUDE 'setupapi.inc'
'$INCLUDE 'msdetect.inc'
'$INCLUDE 'myfuncts.inc'
''Dialog ID's
CONST WELCOME = 100
CONST ASKQUIT = 200
CONST DESTPATH = 300
CONST EXITFAILURE = 400
CONST EXITQUIT = 600
CONST EXITSUCCESS = 700
CONST OPTIONS = 800
CONST APPHELP = 900
CONST BADPATH = 6400
''Attica specific Dialog ID's
CONST SINGLE_ID = 1000
CONST ADMIN_ID = 1001
CONST NETWORK_ID = 1002
GLOBAL WINDIR$ ''Windows Directory
GLOBAL SYSDIR$ ''System Directory
GLOBAL DEST$ ''destination directory.
GLOBAL SOURCE$ ''Source Directory
GLOBAL TITLE$ ''Title of dialog box
GLOBAL COPYRIGHT$ ''Copyright string
GLOBAL ROMDRIVE$
GLOBAL HIDECD$ ''"TRUE" means hide cd-drive in single user installation
GLOBAL ADDPATH$ ''"ON" or "OFF"
GLOBAL ADDGROUP$ ''"ON" or "OFF"
GLOBAL NEWGROUP$ ''group to add to program manager
GLOBAL ITEMEXE$ ''the .exe file to be executed
GLOBAL TEMPDIR$ ''where the setup files are
GLOBAL INFO$ '' which section of setup.ini to read
GLOBAL INF_FILE$ '' name of setup .inf file to use
GLOBAL DLGPROC$ '' which dialog procedure to call
GLOBAL DLG_ID% '' which dialog box to use
GLOBAL INSMODE$ '' Installation mode
GLOBAL INIFILES$ '' .ini files those require changes
GLOBAL Ini$ '' Full path for temporary setup.ini
GLOBAL BACKGROUND$ '' Dll contains Background bitmap
GLOBAL SUBDIR$ '' Subdirectories after Dest directory
CONST VAR_MAX% = 5
GLOBAL VarNames$(VAR_MAX%) '' 1 -- Variable names
GLOBAL VarValues$(VAR_MAX%) '' 2 -- Sub. Strings
DECLARE SUB Install
DECLARE FUNCTION MakePath (szDir$, szFile$) AS STRING
DECLARE SUB AddSectFilesToCopyList (szSect$, szSrc$, szDest$)
DECLARE FUNCTION InitializeInstall LIB "mscuistf.dll" ( hInst%, hWnd% ) AS INTEGER
DECLARE FUNCTION SubVariables( szString$ ) AS STRING
DECLARE FUNCTION audioInstalled LIB "mscuistf.dll" ( ) AS INTEGER
DECLARE FUNCTION audioOpenSession LIB "mscuistf.dll" ( szSession$, bEdit% ) AS INTEGER
DECLARE FUNCTION audioCloseSession LIB "mscuistf.dll" ( hSession% ) AS INTEGER
DECLARE FUNCTION audioOpenFile LIB "mscuistf.dll" ( hSession%, szFileName$ ) AS INTEGER
DECLARE FUNCTION audioCloseFile LIB "mscuistf.dll" ( hSession%, hAudio% ) AS INTEGER
DECLARE FUNCTION audioPlayFile LIB "mscuistf.dll" ( hSession%, hAudio%, CallBack& ) AS INTEGER
DECLARE FUNCTION audioStopFile LIB "mscuistf.dll" ( hSession%, hAudio%, CallBack& ) AS INTEGER
DECLARE FUNCTION audioRewindFile LIB "mscuistf.dll" ( hSession%, hAudio%, CallBack& ) AS INTEGER
INIT:
CUIDLL$ = "mscuistf.dll" ''Custom user interface dll
HELPPROC$ = "FHelpDlgProc" ''Help dialog procedure
ret% = InitializeInstall (hinstFrame(), HwndFrame()) ''max window
TEMPDIR$ = GetSymbolValue("STF_SRCINFPATH")
IF TEMPDIR$ = "" THEN
TEMPDIR$ = GetSymbolValue("STF_CWDDIR")
END IF
''*******************************************************
'' set up mode dependant info - single, admin or network:
'' STF_MODE$ is initialised by _mstest from the command line options
''*******************************************************
INSMODE$ = GetSymbolValue("STF_MODE")
SELECT CASE INSMODE$
CASE "NETWORK"
INFO$ = "Info Net"
ADDPATH$ = "OFF"
ADDGROUP$ = "ON"
GetLocalHardDrivesList "Drives"
DLGPROC$ = "NetInstallDlgProc"
DLG_ID% = NETWORK_ID
CASE "ADMIN"
INFO$ = "Info Admin"
ADDPATH$ = "OFF"
ADDGROUP$ = "OFF"
GetNetworkDrivesList "Drives"
DLGPROC$ = "AdminInstallDlgProc"
DLG_ID% = ADMIN_ID
CASE ELSE
INFO$ = "Info Single"
ADDPATH$ = "ON"
ADDGROUP$ = "ON"
GetLocalHardDrivesList "Drives"
DLGPROC$ = "SingleInstallDlgProc"
DLG_ID% = SINGLE_ID
INSMODE$ = "SINGLE"
END SELECT
''*******************************************************
'' READ FROM SETUP.INI : product-dependent names
''*******************************************************
Ini$ = TEMPDIR$ + "setup.ini"
WINDIR$ = GetWindowsDir()
SYSDIR$ = GetWindowsSysDir()
NEWGROUP$ = GetIniKeyString( Ini$, INFO$, "GroupName" )
ITEMEXE$ = GetIniKeyString( Ini$, INFO$, "ExeFiles" )
INF_FILE$ = GetIniKeyString( Ini$, INFO$, "InfFile" )
INIFILES$ = GetIniKeyString( Ini$, INFO$, "IniFiles" )
HIDECD$ = GetIniKeyString( Ini$, INFO$, "HideCD" )
SUBDIR$ = GetIniKeyString( Ini$, INFO$, "SubDir" )
''*******************************************************
'' Set background bitmap:
''*******************************************************
BACKGROUND$ = GetIniKeyString( Ini$, INFO$, "BkFile" )
IF BACKGROUND$ = "" THEN
BACKGROUND$ = CUIDLL$
LOGO% = 108
ELSE
LOGO% = 1
ENDIF
SetBitmap BACKGROUND$, LOGO%
''*******************************************************
'' default entries for the main dialog box:
''*******************************************************
IF INSMODE$ = "NETWORK" THEN
DEST$ = WINDIR$
ELSE
DEST$ = GetListItem("Drives", 1) + ":\" + GetIniKeyString( Ini$, INFO$, "DestDir" )
END IF
SOURCE$ = GetSymbolValue( "STF_SRCDIR" )
ROMDRIVE$ = GetRomDrive
TITLE$ = GetIniKeyString( Ini$, INFO$, "Title" )
SetTitle TITLE$
COPYRIGHT$ = GetIniKeyString( Ini$, INFO$, "Copyright1" )
COPYRIGHT$ = COPYRIGHT$+CHR$(10)+GetIniKeyString( Ini$, INFO$, "Copyright2" )
COPYRIGHT$ = COPYRIGHT$+CHR$(10)+GetIniKeyString( Ini$, INFO$, "Copyright3" )
''********************************************************
'' DEBUG
''********************************************************
'$IFDEF DEBUG
i% = SetSizeCheckMode(scmOnIgnore) '' could use scmOff; def = scmOnFatal
WinDrive$ = MID$(GetWindowsDir, 1, 1)
IF IsDriveValid(WinDrive$) = 0 THEN
i% = DoMsgBox("Windows drive ('"+WinDrive$+"') is not a valid drive.", "DEBUG", MB_TASKMODAL+MB_ICONHAND+MB_OK)
GOTO QUIT
END IF
'$ENDIF ''DEBUG
''***************************************************************
''READ FILES OUT OF INF FILE LIST
''***************************************************************
szInf$ = TEMPDIR$ + INF_FILE$
ReadInfFile szInf$
SetSymbolValue "Title", TITLE$
SetSymbolValue "Copyright", COPYRIGHT$
SetSymbolValue "SourcePath", SOURCE$
SetSymbolValue "DestPath", DEST$
SetSymbolValue "RomDrive", ROMDRIVE$
SetSymbolValue "AddPath", ADDPATH$
SetSymbolValue "AddGroup", ADDGROUP$
SetSymbolValue "HideRomDrive", HIDECD$
'' welcome box
WELCOME:
sz$ = UIStartDlg(CUIDLL$, 100, "FInfodlgProc", 900, "FHelpDlgProc")
UIPop 1
if sz$ = "EXIT" then
GOSUB ASKQUIT
end if
sz$ = UIStartDlg(CUIDLL$, DLG_ID%, DLGPROC$, 0, "" )
UIPop 1
IF sz$ = "CANCEL" THEN
GOSUB ASKQUIT
GOTO WELCOME
END IF
SOURCE$ = GetSymbolValue( "SourcePath" )
DEST$ = GetSymbolValue( "DestPath" )
ROMDRIVE$ = GetSymbolValue( "RomDrive" )
ADDPATH$ = GetSymbolValue( "AddPath" )
ADDGROUP$ = GetSymbolValue( "AddGroup" )
RemoveSymbol "Title"
RemoveSymbol "Copyright"
RemoveSymbol "SourcePath"
RemoveSymbol "DestPath"
RemoveSymbol "RomDrive"
RemoveSymbol "AddPath"
RemoveSymbol "AddGroup"
AddToBillboardList CUIDLL$, 5000, "FModelessDlgProc", 10
Install
UIPop 1
''*******************************************************
QUIT:
ON ERROR GOTO ERRQUIT
IF ERR = 0 THEN
dlg% = EXITSUCCESS
ELSEIF ERR = STFQUIT THEN
dlg% = EXITQUIT
ELSE
dlg% = EXITFAILURE
END IF
QUITL1:
sz$ = UIStartDlg(CUIDLL$, dlg%, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO QUITL1
END IF
UIPop 1
END
ERRQUIT:
i% = DoMsgBox("Setup sources were corrupted, call (0865) 791346", "Setup Message", MB_OK+MB_TASKMODAL+MB_ICONHAND)
END
BADPATH:
sz$ = UIStartDlg(CUIDLL$, BADPATH, "FInfo0DlgProc", 0, "")
IF sz$ = "REACTIVATE" THEN
GOTO BADPATH
END IF
UIPop 1
RETURN
ASKQUIT:
sz$ = UIStartDlg(CUIDLL$, ASKQUIT, "FQuitDlgProc", 0, "")
IF sz$ = "EXIT" THEN
UIPopAll
ERROR STFQUIT
ELSEIF sz$ = "REACTIVATE" THEN
GOTO ASKQUIT
ELSE
UIPop 1
END IF
RETURN
SUB Install STATIC
'************************************************************************
'** Purpose:
'** Builds the copy list and performs all installation operations.
'*************************************************************************
CreateDir DEST$, cmoNone
'$IFDEF DEBUG
OpenLogFile MakePath(DEST$, "LOGFILE.OUT"), 0
WriteToLogFile ""
WriteToLogFile " User chose as destination directory: '" + DEST$ + "'"
WriteToLogFile ""
WriteToLogFile "May have had to create the directory: " + DEST$
WriteToLogFile ""
'$ENDIF ''DEBUG
''************************************************************************
'' **** Initialize Sub. Variables
''************************************************************************
VarNames$( 0 ) = "[ROMDRIVE]"
VarValues$( 0 ) = ROMDRIVE$
VarNames$( 1 ) = "[DEST]"
IF INSMODE$ = "SINGLE" THEN
VarValues$( 1 ) = DEST$
ELSE
VarValues$( 1 ) = SOURCE$
END IF
VarNames$(2) = "[SOURCE]"
VarValues$(2) = SOURCE$
VarNames$(3) = "[WINDIR]"
VarValues$(3) = WINDIR$
VarNames$(4) = "[SYSDIR]"
VarValues$(4) = SYSDIR$
'' *************************
'' get files to copy
''**************************
IF INSMODE$ = "SINGLE" THEN
Win$ = WINDIR$
Sys$ = SYSDIR$
ELSEIF INSMODE$ = "ADMIN" THEN
Win$ = DEST$
Sys$ = DEST$
ELSE
Win$ = DEST$
Sys$ = SYSDIR$
END IF
'$ifdef DEBUG
WriteToLogFile "Directories (Dest,Win,Sys): "+DEST$+", "+Win$+", "+Sys$
'$endif ''DEBUG
''****************************************************
'' copy Network files -- Single, Admin or Network mode
''****************************************************
AddSectFilesToCopyList "Network Files", SOURCE$, DEST$
AddSectFilesToCopyList "Network Win Files", SOURCE$, Win$
AddSectFilesToCopyList "Network Sys Files", SOURCE$, Sys$
''****************************************************
'' copy Single user files -- Single or Admin mode only
''****************************************************
IF INSMODE$ = "SINGLE" OR INSMODE$ = "ADMIN" THEN
AddSectFilesToCopyList "Single Files", SOURCE$, DEST$
AddSectFilesToCopyList "Single Win Files", SOURCE$, Win$
AddSectFilesToCopyList "Single Sys Files", SOURCE$, Sys$
''**************************
'' copy Sub-directories
''**************************
count% = 1
subcur$ = GetNthFieldFromIniString( SUBDIR$, count% )
WHILE subcur$ <> ""
AddSectFilesToCopyList "Single " + subcur$ + " Files", SOURCE$, DEST$ + subcur$ + "\"
count% = count% + 1
subcur$ = GetNthFieldFromIniString( SUBDIR$, count% )
WEND
END IF
''************************************
'' copy Admin files -- Admin mode only
''************************************
IF INSMODE$ = "ADMIN" THEN
AddSectFilesToCopyList "Admin Files", SOURCE$, DEST$
AddSectFilesToCopyList "Admin Win Files", SOURCE$, Win$
AddSectFilesToCopyList "Admin Sys Files", SOURCE$, Sys$
END IF
''**************************
'' copy files
''**************************
SetCopyGaugePosition 20, 175
CopyFilesInCopyList
ClearCopyList
''*******************************************
'' modify .ini files to subsitute variables
''*******************************************
IF INSMODE$ <> "ADMIN" THEN
count% = 1
inicur$ = GetNthFieldFromIniString( INIFILES$, count% )
WHILE inicur$ <> ""
'$ifdef DEBUG
WriteToLogFile "Ini File: " + inicur$ + " of " + INIFILES$
'$endif ''DEBUG
index% = 1
inikeys$ = GetIniKeyString( Ini$, INFO$, inicur$ + Str$(index%) )
'$ifdef DEBUG
WriteToLogFile "Getting " + inicur$ + Str$(index%)
'$endif ''DEBUG
WHILE inikeys$ <> ""
'$ifdef DEBUG
WriteToLogFile inicur$ + Str$(index%) + " = " + inikeys$
'$endif ''DEBUG
section$ = GetNthFieldFromIniString( inikeys$, 1 )
IF section$ <> "" THEN
keycount% = 2
keycur$ = GetNthFieldFromIniString( inikeys$, keycount% )
WHILE keycur$ <> ""
keyval$ = GetIniKeyString( WINDIR$ + inicur$, section$, keycur$ )
IF keyval$ <> "" THEN
'$ifdef DEBUG
WriteToLogFile "Old Ini Value in " + WINDIR$ + inicur$ + ": [" + section$ + "], " + keycur$ + " = " + keyval$ + " -->"
'$endif ''DEBUG
keyval$ = SubVariables( keyval$ )
CreateIniKeyValue WINDIR$ + inicur$, section$, keycur$, keyval$, cmoOverwrite
END IF
keycount% = keycount% + 1
keycur$ = GetNthFieldFromIniString( inikeys$, keycount% )
WEND
END IF
index% = index% + 1
inikeys$ = GetIniKeyString( Ini$, INFO$, inicur$+Str$(index%) )
WEND
count% = count% + 1
inicur$ = GetNthFieldFromIniString( INIFILES$, count% )
WEND
END IF
''**************************
'' Add Program Item
''**************************
IF ADDGROUP$ = "ON" THEN
IF INSMODE$ = "NETWORK" THEN
ExeDir$ = SOURCE$
ELSE
ExeDir$ = DEST$
END IF
CreateProgmanGroup NEWGROUP$, "", cmoNone
ShowProgmanGroup NEWGROUP$, 1, cmoNone
count% = 1
program$ = GetNthFieldFromIniString( ITEMEXE$, count% )
WHILE program$ <> ""
command$ = GetIniKeyString( Ini$, INFO$, program$ )
itemname$ = GetNthFieldFromIniString( command$, 1 )
option$ = GetNthFieldFromIniString( command$, 2 )
iconname$ = GetNthFieldFromIniString( command$, 3 )
IF iconname$ <> "" THEN
iconidx$ = GetNthFieldFromIniString( command$, 4 )
IF iconidx$ <> "" THEN
iconname$ = iconname$ + "," + iconidx$
iconx$ = GetNthFieldFromIniString( command$, 5 )
IF iconx$ <> "" THEN
iconname$ = iconname$ + "," + iconx$
icony$ = GetNthFieldFromIniString( command$, 6 )
IF icony$ <> "" THEN
iconname$ = iconname$ + "," + icony$
workdir$ = GetNthFieldFromIniString( command$, 7 )
IF workdir$ <> "" THEN
iconname$ = iconname$ + "," + workdir$
END IF
END IF
END IF
END IF
END IF
option$ = SubVariables( option$ )
iconname$ = SubVariables( iconname$ )
command$ = MakePath( ExeDir$, program$ ) + " " + option$
'$ifdef DEBUG
WriteToLogFile "Creating Program Item (Group,Name,Command): " + NEWGROUP$ + ", " + itemname$ + ", " + command$
WriteToLogFile "Others: " + iconname$
'$endif ''DEBUG
CreateProgmanItem NEWGROUP$, itemname$, command$, iconname$, cmoOverwrite
count% = count% + 1
program$ = GetNthFieldFromIniString( ITEMEXE$, count% )
WEND
END IF
''**************************
'' Add Path
''**************************
IF ADDPATH$ = "ON" THEN
GetLocalHardDrivesList "HardDrvs"
drv$ = GetListItem("HardDrvs", 1) + ":\"
IF DoesFileExist(drv$+"autoexec.bat", femExists ) THEN
PrependToPath drv$+"autoexec.bat", drv$+"autex.tmp", DEST$, cmoNone
RemoveFile drv$+"autoexec.old", cmoNone
BackupFile drv$+"autoexec.bat", "autoexec.old"
RenameFile drv$+"autex.tmp", "autoexec.bat"
END IF
END IF
''****************************************
'' Close Log file
''****************************************
'$IFDEF DEBUG
CloseLogFile
'$ENDIF
END SUB
'**
'** Purpose:
'** Appends a file name to the end of a directory path,
'** inserting a backslash character as needed.
'** Arguments:
'** szDir$ - full directory path (with optional ending "\")
'** szFile$ - filename to append to directory
'** Returns:
'** Resulting fully qualified path name.
'*************************************************************************
FUNCTION MakePath (szDir$, szFile$) STATIC AS STRING
IF szDir$ = "" THEN
MakePath = szFile$
ELSEIF szFile$ = "" THEN
MakePath = szDir$
ELSEIF MID$(szDir$, LEN(szDir$), 1) = "\" THEN
MakePath = szDir$ + szFile$
ELSE
MakePath = szDir$ + "\" + szFile$
END IF
END FUNCTION
''
'' Bastardised version of AddSectionFilesToCopyList
'' that does nothing if the section does not exist
''*************************************************************************
SUB AddSectFilesToCopyList (szSect$, szSrc$, szDest$) STATIC
szInf$ = TEMPDIR$ + INF_FILE$
'$ifdef DEBUG
WriteToLogFile "AddSectFilesToCopyList: "+szSect$+", "+szSrc$+", "+szDest$+", "+szInf$
'$endif ''DEBUG
if DoesIniSectionExist( szInf$, szSect$) then
IF FAddSectionFilesToCopyList (szSect$, szSrc$, szDest$) = 0 THEN
ERROR STFERR
END IF
end if
END SUB
''***********************************************
'' This function subsitutes pre-defined
'' variables with their run-time values
''***********************************************
FUNCTION SubVariables( szString$ ) STATIC AS STRING
DIM pos%, lastpos%
DIM Temp$
FOR I% = 0 TO VAR_MAX - 1 STEP 1
lastpos% = 0
pos% = INSTR( 1, szString$, VarNames$( I% ) )
WHILE pos% > lastpos%
lastpos% = Len( VarNames$( I% ) ) + pos%
Temp$ = MID$( szString$, 1, pos% - 1 )
Temp$ = Temp$ + VarValues$( I% )
Temp$ = Temp$ + MID$( szString$, lastpos%, Len( szString$ ) - lastpos% + 1 )
lastpos% = pos% + Len( VarValues$( I% ) )
szString$ = Temp$
pos% = InStr( lastpos%, szString$, VarNames$( I% ) )
WEND
NEXT I%
SubVariables$ = szString$
END FUNCTION